package com.md.api.controller;

import com.md.api.entity.HttpResult;
import com.md.api.entity.dto.ComposeCommitDto;
import com.md.api.entity.dto.ComposeQueryDto;
import com.md.api.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Slf4j
@RequestMapping("/order")
@RestController
public class OrderController {


	@Resource
    OrderService orderSevice;



	@RequestMapping("/myOrder")
	@ResponseBody
	public HttpResult myOrder(HttpServletRequest request,@RequestBody ComposeQueryDto qto) {

		return orderSevice.myOrder(request,qto);
	}


	@RequestMapping("/deleteOrder")
	@ResponseBody
	public HttpResult deleteOrder(HttpServletRequest request,@RequestBody ComposeCommitDto qto) {

		return orderSevice.deleteOrder(request,qto);
	}


	@RequestMapping("/orderDetail")
	@ResponseBody
	public HttpResult orderDetail(HttpServletRequest request,@RequestBody ComposeCommitDto qto) {

		return orderSevice.orderDetail(request,qto);
	}

	@RequestMapping("/notify")
	@ResponseBody
	public HttpResult notify(HttpServletRequest request) {

		return HttpResult.OK;
	}


	@RequestMapping("/confirmOrder")
	@ResponseBody
	public HttpResult confirmOrder(HttpServletRequest request,@RequestBody ComposeQueryDto qto) {

		return orderSevice.confirmOrder(request,qto);
	}
}
